import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class objects {

	Graphics img;
	int col;
	int row;
	int size;
	int posx;
	int posy;
	BufferedImage wall ;
	BufferedImage coins;
	BufferedImage orb;
	BufferedImage exit;
	int object;
	boolean draw = true;

	/**
	 * 
	 * @param img_
	 * @param col_
	 * @param row_
	 * @param size_
	 * @param object_
	 */
	public objects(Graphics img_, int col_, int row_, int size_, int object_) 
	{
		img = img_;
		col = col_;
		row = row_;
		size = size_;
		object = object_;
		
		//only load the images once in the constructor
		try {
			wall = ImageIO.read(new File("images/Wall1.gif"));
			coins = ImageIO.read(new File("images/coin2.gif"));
			orb = ImageIO.read(new File("images/fireorb.gif"));
			exit = ImageIO.read(new File("images/exit.gif"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public void draw(Graphics image)
	{
		//builds the (simple)walls
		if(object == 1 && draw)
		{
			//img.setColor(Color.WHITE);
			//img.fillRect(col * size, row * size, size, size);
			
			image.drawImage(wall, col * size, row * size, null);
		}

		//create exit
		if(object == 2 && draw)
		{
			image.drawImage(exit, col * size, row * size, size, size, null, null);
		}
		
		//color the floors
		if(object == 3 && draw)
		{
			img.setColor(Color.LIGHT_GRAY);
			img.fillRect(col * size, row * size, size, size);
		}
		
		//create a river
		if(object == 5 && draw)
		{
			img.setColor(Color.blue);
			img.fillRect(col * size, row * size, size, size);
		}
		
		//create coins
		if(object == 7 && draw)
		{
			image.drawImage(coins, col * size, row * size, null);
		}
		
		//create orb
		if(object == 8 && draw)
		{
			image.drawImage(orb, col * size, row * size, null);
		}
		
		//create woodwalls
		if(object == 9 && draw)
		{
			image.drawImage(wall, col * size, row * size, null);
		}
	}

	/**
	 * 
	 * getters and setters
	 * 
	 */
	public void setDraw(boolean draw) {
		this.draw = draw;
	}
	
	public int getCol() {
		return col;
	}
	
	public int getRow() {
		return row;
	}
}
